package red.stu.wechat.factory.robot.json;

public class WechatResultJson {
	
	// 是否请求成功
	private Boolean success;
	// 响应时间戳
	private Long responseTime;
	
	public WechatResultJson() {}
	
	public WechatResultJson(boolean success, long responseTime) {
		this.success = success;
		this.responseTime = responseTime;
	}
	
	public static WechatResultJson builder(boolean success) {
		return new WechatResultJson(success, System.currentTimeMillis());
	}
	
	@SuppressWarnings("unchecked")
	public static <T> T builder(WechatResultJson resultJson) {
		resultJson.responseTime = System.currentTimeMillis();
		return (T) resultJson;
	}

	@SuppressWarnings("unchecked")
	public <T> T setSuccess(Boolean success) {
		this.success = success;
		return (T) this;
	}

	public Long getResponseTime() {
		return responseTime;
	}

	public Boolean getSuccess() {
		return success;
	}
	
}
